﻿@model IEnumerable<LynxWebLog.PageData>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.title)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.wp_page_parent_id)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.wp_page_order)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.DateCreated)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.license)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CommentsClosed)
        </th>
    </tr>

@foreach (var item in Model) {
    if (item.IsPublished) { 
    <tr>
        <td>
            <a href="@string.Format("{0}://{1}{2}/Pages/{3}/{4}/?pgName={5}", Context.Request.Url.Scheme,
            Context.Request.Url.Authority, HttpRuntime.AppDomainAppVirtualPath, ViewBag.PageOwner, ViewBag.BlogName, item.title)">@Html.DisplayFor(modelItem => item.title)</a>
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.wp_page_parent_id)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.wp_page_order)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DateCreated)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.license)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CommentsClosed)
        </td>
    </tr>
    }   
}

</table>
